from flask import Flask,render_template
from bokeh.resources import INLINE
import idv_picture as idv
from idv_picture import mpg,vbar_demo
from bokeh.embed import components

from fontTools.ttLib import TTFont
font = TTFont('./static/fonts/themify.woff')
font.saveXML('./static/fonts/themify.xml')


app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/dashboard')
def dashboard():
    p = mpg()


    js_resources = INLINE.render_js()
    css_resources = INLINE.render_css()
    script, div = components(p)

    html = render_template(
        'dashboard2.html',
        plot_script=script,
        plot_div=div,
        js_resources=js_resources,
        css_resources=css_resources
    )
    return html



if __name__ == '__main__':
    app.run()

